import fetch from 'common/src/utils/fetch';
import baseUrl from './env';
// 新增单条成果
function addResultItem(data) {
    return fetch({
        url: `${baseUrl}/achievement/addAchievement`,
        method: 'post',
        data
    });
}
// 通过期刊名称和检索类型获取刊号
function getAcademictByJournalName(data) {
    return fetch({
        url: `${baseUrl}/journalInformation/getJournalName`,
        // ?journalType=${data.journalType}&journalName=${data.journalName}&searchType=${data.searchType}
        method: 'post',
        data
    });
}
// 获取创新创业成果记录
function getAchievementRecord() {
    return fetch({
        url: `${baseUrl}/achievement/achievementRecord`,
        method: 'get',
    });
}
// 学生查看成果记录
function getPersonalAchievementRecord(data) {
    return fetch({
        url: `${baseUrl}/achievement/getPersonalAchievementRecord`,
        method: 'post',
        data
    });
}
// 删除单条成果
function deleteResultItem(id) {
    return fetch({
        url: `${baseUrl}/achievement/deleteAchievement/${id}`,
        method: 'delete'
    });
}
function getAchievementById(data) {
    return fetch({
        url: `${baseUrl}/achievement/getAchievementById`,
        method: 'get',
        params: data
    });
}
function editResultItem(data) {
    return fetch({
        url: `${baseUrl}/achievement/editAchievement/${data.id}`,
        method: 'put',
        data
    });
}
function download(data) {
    return fetch({
        url: `${baseUrl}/achievement/readyExportAchievement?exportType=${data.exportType}`,
        method: 'post',
        data: data
    });
}
function statisticsDownload(data) {
    return fetch({
        url: `${baseUrl}/achievement/readyExportStatistics`,
        method: 'post',
        data: data
    });
}
// 记录导出--------------------------------------------
function recordDownload(data) {
    return fetch({
        url: `${baseUrl}/achievement/downloadWord`,
        // url: `${baseUrl}/demo/downloadWord`,
        method: 'post',
        data: data
    });
}
function exportStatus(key) {
    return fetch({
        url: `${baseUrl}/achievement/getExportResult/${key}`,
        method: 'get'
    });
}
function submitResult(data) {
    return fetch({
        url: `${baseUrl}/achievement/submit`,
        method: 'post',
        data: data
    });
}
function approveRevoke(data) {
    return fetch({
        url: `${baseUrl}/achievement/approveRevoke`,
        method: 'post',
        data: data
    });
}
function approveRefuse(data) {
    return fetch({
        url: `${baseUrl}/achievement/approveRefuse`,
        method: 'post',
        data: data
    });
}
function approveAgree(data) {
    return fetch({
        url: `${baseUrl}/achievement/approveAgree`,
        method: 'post',
        data: data
    });
}

export default {
    'addResultItem': addResultItem, // 新增单条成果
    'getAcademictByJournalName': getAcademictByJournalName, // 通过期刊名称和检索类型获取刊号
    'getAchievementRecord': getAchievementRecord, // 获取创新创业成果记录
    'deleteResultItem': deleteResultItem, // 删除单条成果
    'getAchievementById': getAchievementById, // 通过id获取单条成果
    'editResultItem': editResultItem, // 编辑成果
    'download': download, // 成果导出第一个接口
    'statisticsDownload': statisticsDownload, // 统计导出第一个接口
    recordDownload,
    'exportStatus': exportStatus, // 导出第二个接口
    'submitResult': submitResult, // 提交我的申请
    'approveRevoke': approveRevoke, // 撤回我的待办
    'approveRefuse': approveRefuse, // 批量驳回我的待办
    'approveAgree': approveAgree, // 批量通过
    getPersonalAchievementRecord
};

